<?php $ui = $this->load->library('Ui'); ?>
<h2>Edit Users</h2>

<?php
	$header = 	$ui->makeOption('<a href="#" rel="#overlay">Get Help With This Page</a>' . ' '.
					anchor('user/admin', 'Manage Users') . ' '.
					anchor('user/admin/add', 'Add a User'). ' ', 1 ).
					'<div class="clear"></div>';
	$content = '<form method="POST"><table class="hidden-table" cellspacing="1" cellpadding="5" width="100%"><tr><td width="200">User ID: </td><td>'.$user['id'].'</td><td></td></tr>
			<tr><td width="200">Username: </td><td>'.$user['username'].'</td><td></td></tr>
			<tr><td>Email: </td><td><input type="text" name="user_email" class="form" value="'.$user['email'].'"/></td><td>'.form_error('user_email').'</td></tr>
            <tr><td>Password: </td><td><input type="text" name="user_password" class="form" /></td><td>'.form_error('user_password').'</td></tr>
            <tr><td>Confirm Password: </td><td><input type="text" name="user_password2" class="form" /></td><td>'.form_error('user_password2').'</td></tr>
			<tr><td>Group: </td><td>
				<select name="user_group">';
	
	foreach($group as $var => $value){
		$content .= '<option value="'.$value['id'].'">'.$value['title'].'</option>';
	}
			
	$content .= '</select>';
	$content .= '</td><td>'.form_error('user_group').'</td></tr>
            <tr><td>Display Name: </td><td><input type="text" name="display_name" class="form" value="'.$user['display_name'].'" /></td><td>'.form_error('display_name').'</td></tr>
			<tr>
                <td>Active: </td>
                <td>';
                    if($user['activated'] <> 1)
                    {						
                            $content .= "Account Disabled&nbsp;&nbsp;&nbsp;&nbsp;";
                        $content .= anchor('user/admin/activate/'.$user['id'], "[Activate]");
                    }
                    else
                    {
                        $content .= "Account Enabled&nbsp;&nbsp;&nbsp;&nbsp;";
                        $content .= anchor('user/admin/deactivate/'.$user['id'], "[Deactivate]");
                    }

     $content .=  '</td><td></td></tr><tr><td colspan="3"><input type="submit" value="Edit User" /></td></tr></table></form>';
     echo $ui->makeDialog('Add a User'.$header, $content, 'maximize center');
?>
<div class="overlay" id="overlay">

    <!-- here is the content for overlay, can be anything -->
    <h2 style="margin:10px 0">Help! <em>Using the Edit User feature.</em></h2>

    <p>
            <strong>Email</strong><br />
            <span class="help">The users email.</span><br /><br />
            <strong>Display Name</strong><br />
            <span class="help">A name to be displayed within the site, for example, someones full name. It can Be alpha-numeric and contain dashes or underscores.</span><br /><br />
            <strong>Password</strong><br />
            <span class="help">The password the user will sue to login to the site. The password can be made up of letters, numbers and symbols.</span><br /><br />
            <strong>Password Again</strong><br />
            <span class="help">Re-Enter the password to help prevent a mistake being made.</span><br /><br />
            <strong>Group</strong><br />
            <span class="help">The group that you want to add the new user too.</span><br /><br />
            <strong>Display Name</strong><br />
            <span class="help">A name to be displayed within the site, for example, someones full name. It can Be alpha-numeric and contain dashes or underscores.</span><br /><br />
            <strong>Active</strong><br />
            <span class="help">Control whether a user can login or not.</span><br /><br />

</p>

</div>
